<template>
	<div>
		<el-dialog width="80%" top="1vh" title="查看钞能力大数据" :visible.sync="dialogVisible" :close-on-click-modal="true">
			<h2>{{ initData.cert_name }}钞能力大数据报告</h2>
			<br>
			<el-row>
				<el-col :span="8">报告生成时间：{{ initData.start_at }}</el-col>
				<el-col :span="8">有效期至：{{ initData.end_at }}</el-col>
				<el-col :span="8">订单ID：{{ initData.orderId }}</el-col>
			</el-row>
			<br>
			<p class="red">报告生成可能有延迟，请确认报告成功生成</p>
			<br>
			<!-- <el-descriptions title="基本数据" direction="vertical" :column="5" border>
				<el-descriptions-item label="姓名">{{ initData.cert_name }}</el-descriptions-item>
				<el-descriptions-item label="性别">{{ Object.keys(this.initData.resp_data).length ?
						initData.resp_data.base_info.gender : ''
				}}</el-descriptions-item>
				<el-descriptions-item label="年龄">
					{{ Object.keys(this.initData.resp_data).length ? initData.resp_data.base_info.age : '' }}
				</el-descriptions-item>
				<el-descriptions-item label="手机号码">{{ Object.keys(this.initData.resp_data).length ?
						initData.resp_data.base_info.phone : ''
				}}</el-descriptions-item>
				<el-descriptions-item label="手机号码归属地">{{ Object.keys(this.initData.resp_data).length ?
						initData.resp_data.base_info.phone_address : ''
				}}</el-descriptions-item>
				<el-descriptions-item label="身份证号码" :span="2">{{ Object.keys(this.initData.resp_data).length ?
						initData.resp_data.base_info.ident_number : ''
				}}</el-descriptions-item>
				<el-descriptions-item label="身份证号地址">{{ Object.keys(this.initData.resp_data).length ?
						initData.resp_data.base_info.ident_number_address : ''
				}}</el-descriptions-item>
			</el-descriptions> -->
			<br>
			<el-descriptions title="还款能力" direction="vertical" :column="5" border>
				<el-descriptions-item label="还款能力等级">{{ initData.level }}</el-descriptions-item>
				<el-descriptions-item label="还款能力稳定性">{{ initData.ability }}</el-descriptions-item>
			</el-descriptions>
			<br>
			<p class="red">
				还款能力等级:
				1-10 级数值越高还款能力越强
				-100: 未查的或无法评估
			</p>
			<br>
			<p class="red">
				还款能力稳定性:
				结果范围 1-6,数值越高稳定性越
				强
				-100: 未查的或无法评估
			</p>
			<br>
			<p class="red">
				注意：还款能力以及还款稳定性仅做参考，不能作为审核的主要判断依据
			</p>
			<br>
		</el-dialog>
	</div>

</template>
    
<script>
import { getAbData } from "@/api/order";
export default {
	props: ['editItem'],
	data() {
		return {
			form: {
				orderId: '',
				cert_name: '', //真实姓名
				cert_no: '', //身份证号
				mobile: '', //手机号
			},
			initData: {
				cert_name: '',
				cert_no: '',
				mobile: '',
				resp_data: {},
				start_at: '',
				end_at: '',
				orderId: '',
				level: '', //还款能力等级
				ability: ''  //还款能力稳定性
			},
			respData: {},
			dialogVisible: false
		}
	},
	methods: {

		getData() {
			this.initData.cert_name = this.form.cert_name;
			this.initData.cert_no = this.form.cert_no;
			this.initData.mobile = this.form.mobile;
			getAbData(this.form).then(res => {
				this.initData.resp_data = res.resp_data;
				this.initData.start_at = res.start_at;
				this.initData.end_at = res.end_at;
				this.initData.orderId = res.order_id;
				this.initData.level = res.resp_data.level;
				this.initData.ability = res.resp_data.ability;
				console.log(res);
			});
		},
		init() {
			for (let key in this.form) {
				// this.form[key] = this.editItem[key].toString() || '';
				this.form[key] = this.editItem[key]
			}
		}

	},
	watch: {
		dialogVisible(val) {
			if (val) {
				this.init();
				this.getData();
			}
		}
	}
}
</script>
    
<style lang="scss" scoped>
.type_tip {
	color: #999999;
	line-height: 22px;

	span {
		color: #ff4146;
	}
}
</style>
    